<template>
  <u-form-grid :data="formGrid" ref="goods" @selectOk="selectOk"></u-form-grid>
</template>

<script>
  export default {
    name: 'ActivityAttr',
    data() {
      return {
        formGrid: {
          options: {
            version: 'v2',
            url: {
              page: "/activityAttr/page",
              save: "/activityAttr/save",
              delete: "/activityAttr/delete",
            }
          },
          tips: {title: "活动属性变更"},

          form: {
            modal: {
              title: "活动属性变更"
            },
            columns: [
              {label: "活动编码", type: "text", name: "id", required: true},
              {label: "活动名称", type: "text", name: "keyName", required: true},
              {label: "属性名称", type: "text", name: "name", required: true},
              {label: "属性值", type: "text", name: "value", required: true},
              {label: "备注", type: "text", name: "remark", required: true},

            ]
          },
          table: {
            operation: {
              primaryKey: "id",
            },
            columns: [
              {title: '活动编码', key: 'id'},
              {title: '活动名称', key: 'keyName'},
              {title: '属性名称', key: 'name'},
              {title: '属性值', key: 'value'},
              {title: '备注', key: 'remark'},
            ]
          }
        }
      }
    },
    methods: {
      selectOk(goods) {
        console.log("选择的商品:%o", goods);
        //调用方法时传递参数
        this.showSelectGoodsInfo = false;

        if (!goods || goods.length <= 0) {
          this.$Message.info({content: "请选择参加活动的商品"});
          return;
        }
        let ids = [];
        for (let item of goods) {
          ids.push(item.id);
        }

        let params = {
          id: this.formGoodsGridParams.activityFullPathIds,
          goodsIds: ids
        };

      }
    },
  }
</script>
